Skip to content

fix treesitter node recursion for nvim v0.12#612

Merged
ray-x merged 1 commit intoray-x:masterfrom
zach-wahrer:zw.fix-node-recursion
Apr 1, 2026
Merged

fix treesitter node recursion for nvim v0.12#612
ray-x merged 1 commit intoray-x:masterfrom
zach-wahrer:zw.fix-node-recursion

Conversation

@zach-wahrer
Copy link
Copy Markdown
Contributor

@zach-wahrer zach-wahrer commented Mar 31, 2026

I'm getting the following error when trying to run GoAddTest , running on Neovim v0.12.0:

stack traceback:
...re/bob/v0.12.0/share/nvim/runtime/lua/vim/treesitter.lua:196: in function 'get_range'
...re/bob/v0.12.0/share/nvim/runtime/lua/vim/treesitter.lua:231: in function 'get_node_text'
.../zach/.local/share/nvim/lazy/go.nvim/lua/go/ts/nodes.lua:185: in function 'accumulator'
...nvim/lazy/nvim-treesitter/lua/nvim-treesitter/locals.lua:143: in function 'recurse_local_nodes'
...nvim/lazy/nvim-treesitter/lua/nvim-treesitter/locals.lua:146: in function 'recurse_local_nodes'
...nvim/lazy/nvim-treesitter/lua/nvim-treesitter/locals.lua:146: in function 'recurse_local_nodes'
.../zach/.local/share/nvim/lazy/go.nvim/lua/go/ts/nodes.lua:177: in function 'get_all_nodes'
.../zach/.local/share/nvim/lazy/go.nvim/lua/go/ts/nodes.lua:272: in function 'nodes_at_cursor'
/Users/zach/.local/share/nvim/lazy/go.nvim/lua/go/ts/go.lua:200: in function 'get_func_method_node_at_pos'
...s/zach/.local/share/nvim/lazy/go.nvim/lua/go/gotests.lua:44: in function 'fun_test'
.../zach/.local/share/nvim/lazy/go.nvim/lua/go/commands.lua:351: in function <.../zach/.local/share/nvim/lazy/go.nvim/lua/go/commands.lua:350>

This additional code fixes the issue and restores functionality, but I'm not familiar enough with the plugin/repo to know if this has other, unintended impacts. I also couldn't get the local tests to fully pass, but it looked unrelated to these changes?

I tested GoAddTest with this code on Neovim v0.12.0, nightly, and v0.11.5, and it worked as expected on all versions, so this seems v0.11 safe as well.

Thanks for the awesome plugin! I use it everyday and appreciate all the hard work that went into it's creation and maintenance.

@s0x90
Copy link
Copy Markdown

s0x90 commented Apr 1, 2026

Same issue with GoTestFunc Neovim v0.12.0:

Lua :command callback: .../neovim/0.12.0/share/nvim/runtime/lua/vim/treesitter.lua:196: attempt to call method 'range' (a nil value)
stack traceback:
        .../neovim/0.12.0/share/nvim/runtime/lua/vim/treesitter.lua:196: in function 'get_range'
        .../neovim/0.12.0/share/nvim/runtime/lua/vim/treesitter.lua:231: in function 'get_node_text'
        ...s0x90/.local/share/nvim/lazy/go.nvim/lua/go/ts/nodes.lua:185: in function 'accumulator'
        ...e/nvim/lazy/guihua.lua/lua/guihua/ts_obsolete/locals.lua:143: in function 'recurse_local_nodes'
        ...e/nvim/lazy/guihua.lua/lua/guihua/ts_obsolete/locals.lua:146: in function 'recurse_local_nodes'
        ...e/nvim/lazy/guihua.lua/lua/guihua/ts_obsolete/locals.lua:146: in function 'recurse_local_nodes'
        ...s0x90/.local/share/nvim/lazy/go.nvim/lua/go/ts/nodes.lua:177: in function 'get_all_nodes'
        ...s0x90/.local/share/nvim/lazy/go.nvim/lua/go/ts/nodes.lua:272: in function 'nodes_at_cursor'
        ...rs/s0x90/.local/share/nvim/lazy/go.nvim/lua/go/ts/go.lua:200: in function 'get_func_method_node_at_pos'
        ...s/s0x90/.local/share/nvim/lazy/go.nvim/lua/go/gotest.lua:385: in function 'get_test_func_name'
        ...s/s0x90/.local/share/nvim/lazy/go.nvim/lua/go/gotest.lua:520: in function 'test_func'
        ...s0x90/.local/share/nvim/lazy/go.nvim/lua/go/commands.lua:325: in function <...s0x90/.local/share/nvim/lazy/go.nvim/lua/go/commands.lua:324>

Copy link
Copy Markdown
Owner

@ray-x ray-x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I am refactoring the treesitter code as well. But happy to merge your PR before I figure out the Neovim Treesitter latest changes/impacts.

@ray-x ray-x merged commit 3cfece4 into ray-x:master Apr 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants